package com.xhapi.controller;

import com.xhapi.pojo.entity.ApiResult;
import com.xhapi.pojo.entity.Text;
import com.xhapi.service.TextService;
import com.xhapi.utils.ApiResultHandler;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/text_rewriting")
@RequiredArgsConstructor
@Slf4j
public class TextRewritingController {
    @Autowired
    TextService textService;
    @PostMapping
    public ApiResult textRewriting(@RequestBody Text text) {
        String rewrittenText = textService.rewriteText(text);
        return ApiResultHandler.success(rewrittenText);
    }
}
